package com.webchat.common.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum AiFunctionEnum {

    CHAT("对话"),
    IMAGE("文生图");

    private String functionName;


    public static String getFunctionName(String function) {
        AiFunctionEnum func = getFunction(function);
        return func == null ? "未识别到意图" : func.getFunctionName();
    }

    public static AiFunctionEnum getFunction(String function) {
        if (StringUtils.isBlank(function)) {
            return null;
        }
        for (AiFunctionEnum aiFunctionEnum : AiFunctionEnum.values()) {
            if (aiFunctionEnum.name().equals(function)) {
                return aiFunctionEnum;
            }
        }
        return null;
    }
}
